package summary.io;

import java.io.*;

/**
 * @AUTHOR LYF
 * @DATE 2022/3/8
 * @VERSION 1.0
 * @DESC
 * IO 的简单示例：实现文本的读入/读出，文件的操作
 */
public class IOTestDemo {

    public static void main(String[] args) throws IOException {
        String path = "E:\\JavaProjects\\DemoProjects\\spring-recruiment\\java-base\\src\\main\\java\\io\\file1.txt";
        File file = new File(path);
        FileInputStream inputStream = new FileInputStream(file);

        //BufferedReader bufferedReader = new BufferedReader(new FileReader(file));
        byte[] bytes = new byte[1024];
        inputStream.read(bytes);
        String str = new String(bytes);

        FileOutputStream outputStream = new FileOutputStream(file);
        outputStream.write("add test".getBytes());
        System.out.println(str);
    }

}
